laravel migration set default value

62

laravel migration default value -

$table->increments('id');
            $table->string('name');
            $table->string('url');
            $table->string('country');
            $table->tinyInteger('status')->default('1');
            $table->timestamps();

laravel migration change default value -

Schema::table('users', function ($table) {
    $table->integer('active')->default(0)->change();
});

default null migration laravel -

$table->integer('parent_item_category_id')->nullable();

how assign default value to laravel migration column -

You can use change() method:

Schema::table('users', function ($table) {
    $table->integer('active')->default(0)->change();
});

Comments

Submit
0 Comments